define([
    "UtilDir/util",
    "UtilDir/tool",
    "UtilDir/dialog",
    "UtilDir/combotree",
    "UtilDir/searchBlock",
    "FwDir/util/js/bootstrap-select",
    "EasyUI", "EasyUI-lang"
], function (Util, Tool, Dialog, Combotree, SearchBlock) {

    var sysPath = getServer() + "/static/app/fwsjcj";

    var allotTaskFormHtml = sysPath + "/sifttaskmanage/views/allottaskForm.html";
    var TaskFormHtml = sysPath + "/sifttaskmanage/views/taskForm.html";
    var formList = sysPath + "/siftcollect/views/formList.html";
    var createTaskFormHtml = sysPath + "/sifttaskmanage/views/taskSetForm.html";
    var getDivisionController = function () {
        return getServer() + "/platform/org/divisions/";
    };
    /**
     * 页面初始化
     */
    var init = function () {
        initSearchBlock();
        queryBtnBind();
        createTaskGrid();
        Util.preventclick("taskName");
        //浏览器窗口大小变化后，表格宽度自适应
        $(window).resize(function () {
            createTaskGrid();
        });
    };
    var initSearchBlock = function () {
        SearchBlock.init("searchBlock");
    };
    var queryBtnBind = function () {
        $("#btnSearch").click(function () {
            createTaskGrid();
        });
        $("#btnReset").click(function () {
            $("#status").val("");
            $("#taskName").val("");
        });
    };

    var createTaskGrid = function () {
        $("#taskGrid").datagrid({
            url: getServer() + "/fw/task/taskPage/1",
            method: "GET",
            nowrap: false,
            columns: [
                [{
                        field: "ck",
                        checkbox: true
                    },
                    {
                        field: 'taskNum',
                        title: '任务编号',
                        width: '18%',
                        align: 'center'
                    },
                    {
                        field: 'taskName',
                        title: '任务名称',
                        width: '28%',
                        align: 'center'
                    },
                    /* {field:'division',title:'任务地区',width:'20%',align:'center'},*/
                    {
                        field: 'groupName',
                        title: '任务小组',
                        width: '18%',
                        align: 'center'
                    },
                    {
                        field: 'status',
                        title: '任务状态',
                        width: '14%',
                        align: 'center',
                        formatter: function (value, rowData, rowIndex) {
                            if (value == '0') {
                                return '未分配';
                            } else if (value == '1') {
                                return '进行中';
                            } else if (value == '2') {
                                return '已完成';
                            }
                        }
                    },
                    {
                        field: 'operation',
                        title: '操作',
                        width: '18.8%',
                        align: 'center',
                        formatter: function (value, rowData, rowIndex) {
                            return '<a onclick="_formlist(\'' + rowData.taskId + '\',\'' + rowData.taskName + '\')">表单列表</a>';
                        }
                    }
                ]
            ],
            queryParams: {
                status: $("#status").val(),
                taskName: $("#taskName").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };
    window._formlist = function (taskId, taskName) {
        var slidebar = Util.slidebar({
            url: formList,
            width: "1000px",
            cache: false,
            close: true,
            afterOpen: function () {
                queryFormBtnBind(taskId, taskName);
                initSearchFormBlock();
                createFormGrid(taskId, taskName);
            },
            afterLoad: function () {}
        });
    };
    var initSearchFormBlock = function () {
        SearchBlock.init("searchFormBlock");
    };
    var queryFormBtnBind = function (taskId, taskName) {
        $("#btnFormSearch").click(function () {
            createFormGrid(taskId, taskName);
        });
        $("#btnFormReset").click(function () {
            $("#statusForm").val("");
            $("#structureNum").val("");
        });
    };

    var createFormGrid = function (taskId, taskName) {
        var opts1;
        //  	var taskId = taskId;
        //  	var taskName = taskName;
        $("#formListGrid").datagrid({
            url: getServer() + "/fw/structure/page",
            method: "get",
            nowrap: false,
            columns: [
                [{
                        field: "ck",
                        checkbox: true
                    },
                    //          	{
                    //                  field: 'myNo',
                    //                  title: '序号',
                    //                  align: 'center',
                    //                  width: '4%',
                    //                  formatter: function (value, row, index) {
                    //                      if (!opts1) {
                    //                          opts1 = $('#formListGrid').datagrid('options');
                    //                      }
                    //                      return opts1.pageSize * (opts1.pageNumber - 1) + index + 1;
                    //                  }
                    //              },
                    {
                        field: 'taskName',
                        title: '所属任务',
                        width: '15%',
                        align: 'center',
                    },
                    {
                        field: 'structureNum',
                        title: '样本编号',
                        width: '15%',
                        align: 'center',
                        formatter: function (value, rowData, rowIndex) {
                            return '<a href="#" onclick="_viewForm(\'' + taskId + '\',\'' + taskName + '\',\'' + rowData.structureType + '\',\'' + rowData.id + '\',\'' + rowData.status + '\');"> ' + rowData.structureNum + ' </a> '

                        }
                    },
                    {
                        field: 'belongtoProvince',
                        title: '所属省',
                        width: '7%',
                        align: 'center'
                    },
                    {
                        field: 'belongtoCity',
                        title: '所属市',
                        width: '7%',
                        align: 'center'
                    },
                    {
                        field: 'structureType',
                        title: '建筑物类型',
                        width: '10%',
                        align: 'center',
                        formatter: function (value) {
                            if (value == 0) {
                                return '砖混结构';
                            } else if (value == 1) {
                                return '多层钢筋混凝土结构';
                            } else if (value == 2) {
                                return '高层结构';
                            } else if (value == 3) {
                                return '工业厂房结构';
                            } else if (value == 4) {
                                return '空旷结构';
                            } else if (value == 5) {
                                return '土木结构';
                            } else if (value == 6) {
                                return '木结构';
                            } else if (value == 7) {
                                return '石结构';
                            } else if (value == 8) {
                                return '其它'
                            } else if (value == 9) {
                                return '砖木结构'
                            }
                        }
                    },
                    {
                        field: 'buildingName',
                        title: '建筑物名称',
                        width: '16%',
                        align: 'center',

                    },
                    {
                        field: 'status',
                        title: '数据状态',
                        width: '9%',
                        align: 'center',
                        formatter: function (value) {
                            console.log(value)
                            if (value == 1) {
                                return '未审核';
                            } else if (value == 2) {
                                return '审核未通过';
                            } else if (value == 3) {
                                return '审核通过';
                            } else if (value == 4) {
                                return '省级退回';
                            } else if (value == 5 ) {
                                return '中心退回';
                            } else {
                                return '未提交';
                            }
                        }
                    },
                    {
                        field: 'collectUser',
                        title: '信息采集人',
                        width: '10%',
                        align: 'center'
                    },
                    {
                        field: 'operation',
                        title: '操作',
                        width: '10%',
                        align: 'center',
                        formatter: function (value, rowData, rowIndex) {
                            console.info(rowData);
                            var html = '<a onclick="_upload(\'' + rowData.structureId + '\',\'' + rowData.structureType + '\',\'' + rowData.id + '\')">上传附件</a >';
                            if(rowData.status=='4'){
                                html += '<br><a onclick="_backOpion(\'' +  rowData.id  + '\')">退回原因</a >'
                            }
                            return html;
                        }
                    }
                ]
            ],
            toolbar: [{
                    iconCls: 'fa fa-plus-circle',
                    text: "新建表单",
                    handler: function () {
                        newForm(taskId, taskName)
                    }
                }, {
                    iconCls: 'fa fa-trash-o',
                    text: "删除",
                    handler: function () {
                        deleteFm(taskId, taskName)
                    }
                }, {
                    iconCls: 'fa fa-upload',
                    text: "导入",
                    handler: function () {
                        selectType(taskId, taskName)

                    }
                },
                //          {
                //              iconCls: 'fa fa-download',
                //              text: "导出",
                //              handler: function () {
                //                  exportZw()
                //              }
                //          },
                {
                    iconCls: 'fa fa-download',
                    text: "提交",
                    handler: function () {
                        submit(taskId, taskName)
                    }
                }
            ],
            queryParams: {
                taskId: taskId,
                structureNum:$("#structureNum").val(),
                status:$("#statusForm").val(),
            },
            pagination: true,
            pageSize: 10
        });
    };
    window._upload = function (structureId, type,id) {
        var buttons = [];
        buttons.push({
            name: '确定',
            callback: function () {
                //点击确定
                var fileId = $("#detailFile").val();
                $.ajax({
                    url: getServer() + "/fw/structure/uploadFile/" + structureId + "/" + type + "/" + fileId,
                    contentType: "application/json",
                    type: "post",
                    success: function (data) {
                        Util.alert(data.message);

                    }
                });
                dialog.hide();
            }
        });
        var dialog = Dialog({
            id: "viewTeamDialog",
            cache: false,
            title: '上传附件', //dialog标题
            width: "900px",
            height: "250px",
            body: '<div id="TeamGrid">' +
                '<div class="col-md-12 form-horizontal">' +
                '<div class="form-group">' +
                '<label for="detailFile" class="col-md-2 control-label">详细文档:</label>' +
                '<div class="col-md-10" id="multiFileUpload">' +
                '<div class="requird">附件数量不能超过50个，附件过多可压缩为压缩包进行上传!</div>' +
                '<input id="detailFile" type="hidden" name="detailFile" class="form-control"  />' +
                '</div>' +
                '</div>' +
                '</div>' +
                '</div>',
            buttons: buttons,
            afterOpen: function () {
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + id,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        viewFileUpload(data.detailFile);
                    }

                })
            }
        });
        dialog.show();
    };


    //退回
    window._backOpion = function (id) {
        var siftBackDataHtml = openBackPage();
        var slidebar = Util.slidebar({
            url: siftBackDataHtml,
            width: "600px",
            cache: false,
            close: true,
            afterLoad: function () {
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + id,
                    type: "get",
                    success: function (data) {
                        $('#provinceOpinion').attr("readonly","readonly")//将input元素设置为readonly
                        // if(provinceOpinion=='null' || provinceOpinion==null){
                        //     $("#provinceOpinion").val(superOpinion);
                        // }else{
                        $("#provinceOpinion").val(data.provinceBackOpinion);
                        //}
                    }
                })

            }
        });
    };
    //打开退回意见页面
    var openBackPage = function(){
        return sysPath + "/siftcollect/views/backPage.html";
    }
    var selectType = function (taskId, taskName) {
        var buttons = [];
        buttons.push({
            name: '确定',
            callback: function () {
                //点击确定
                var formType = $("#formType").val();
                uploadZw(formType, taskId, taskName);
                dialog.hide();
            }
        });
        var dialog = Dialog({
            id: "viewTeamDialog",
            cache: false,
            title: '选择表单类型', //dialog标题
            width: "400px",
            height: "250px",
            body: '<div id="TeamGrid">' +
                '<div class="col-md-12 form-horizontal">' +
                '<div class="form-group">' +
                '<label for="formType" class="col-md-4 control-label"> </span>表单类型:</label>' +
                '<div class="col-md-8">' +
                '<select class="form-control" id="formType" name="formType" >' +
                '<option value="" disabled selected style="display:none;">请选择</option>' +
                '<option value="0">砖混结构</option>' +
                '<option value="9">砖木结构</option>' +
                '<option value="1">多层钢筋混凝土结构</option>' +
                '<option value="2">高层结构</option>' +
                '<option value="3">工业厂房结构</option>' +
                '<option value="4">空旷结构</option>' +
                '<option value="5">土木结构</option>' +
                '<option value="6">木结构</option>' +
                '<option value="7">石结构</option>' +
                '<option value="8">其它</option>' +
                '</select>' +
                '</div>' +
                '</div>' +
                '</div>' +
                '</div>',
            buttons: buttons,
            afterOpen: function () {

            }
        });
        dialog.show();
    };
    var exportZw = function () {
        window.location.href = getZwController() + "exportFile";
    };

    var uploadZw = function (type, taskId, taskName) {
        var url;
        var ajaxUrl;
        if (type == 0) {
            // url = getServer() + "/fw/brick/downMould";
            url = getServer() + "/static/excel/砖混结构.xlsx";
            ajaxUrl = getServer() + "/fw/brick/export/" + taskName + "/" + taskId;
        } else if (type == 1) {
            // url = getServer() + "/fw/mulConcrete/downMould";
            url = getServer() + "/static/excel/多层钢筋混凝土结构.xlsx";
            ajaxUrl = getServer() + "/fw/mulConcrete/export/" + taskName + "/" + taskId;
        } else if (type == 2) {
            // url = getServer() + "/fw/high/downMould";
            url = getServer() + "/static/excel/高层结构.xlsx";
            ajaxUrl = getServer() + "/fw/high/export/" + taskName + "/" + taskId;
        } else if (type == 3) {
            // url = getServer() + "/fw/factory/downMould";
            url = getServer() + "/static/excel/工业厂房结构.xlsx";
            ajaxUrl = getServer() + "/fw/factory/export/" + taskName + "/" + taskId;
        } else if (type == 4) {
            // url = getServer() + "/fw/wide/downMould";
            url = getServer() + "/static/excel/空旷结构.xlsx";
            ajaxUrl = getServer() + "/fw/wide/export/" + taskName + "/" + taskId;
        } else if (type == 5) {
            // url = getServer() + "/fw/building/downMould";
            url = getServer() + "/static/excel/土木结构.xlsx";
            ajaxUrl = getServer() + "/fw/building/export/" + taskName + "/" + taskId;
        } else if (type == 6) {
            // url = getServer() + "/fw/wood/downMould";
            url = getServer() + "/static/excel/木结构.xlsx";
            ajaxUrl = getServer() + "/fw/wood/export/" + taskName + "/" + taskId;
        } else if (type == 7) {
            // url = getServer() + "/fw/stone/downMould";
            url = getServer() + "/static/excel/石结构.xlsx";
            ajaxUrl = getServer() + "/fw/stone/export/" + taskName + "/" + taskId;
        } else if (type == 8) {
            // url = getServer() + "/fw/other/downMould";
            url = getServer() + "/static/excel/其它.xlsx";

            ajaxUrl = getServer() + "/fw/other/export/" + taskName + "/" + taskId;
        } else if (type == 9) {
            // url = getServer() + "/fw/other/downMould";
            url = getServer() + "/static/excel/砖木结构.xlsx";

            ajaxUrl = getServer() + "/fw/brickwood/export/" + taskName + "/" + taskId;
        }
        console.log('url:', url,  'ajaxUrl', ajaxUrl)
        $("#uploadModal").modal();
        $("#uploadModal").on("shown.bs.modal", function () {
            //          var url = "http://localhost:8080" + getZwController() + "downloadTemplate";
            $("#downloadZwExcelTemplate").attr("href", url);
        });

        $('#uploadButton').off("click");
        $("#uploadButton").on("click", function () {
            var uploadinput = document.getElementById("uploadFile");
            if (uploadinput.value == "") {
                Util.alert("上传前请先选择文件!");
                return;
            }
            var formData = new FormData();
            formData.append("file", uploadinput.files[0]);
            $.ajax({
                url: ajaxUrl,
                data: formData,
                processData: false, //因为data值是FormData对象，不需要对数据做处理。
                contentType: false,
                type: "POST",
                success: function (data) {
                    $('#uploadModal').modal('hide');
                    uploadinput.value = null;
                    Util.alert(data);
                    createFormGrid(taskId, taskName);
                }
            });
        });
    };
    var newForm = function (taskId, taskName) {
        var buttons = [];
        buttons.push({
            name: '确定',
            callback: function () {
                //点击确定


                var formType = $("#formType").val();
                openForm(formType, taskId, taskName);

                dialog.hide();
            }
        });
        var dialog = Dialog({
            id: "viewTeamDialog",
            cache: false,
            title: '选择表单类型', //dialog标题
            width: "400px",
            height: "250px",
            body: '<div id="TeamGrid">' +
                '<div class="col-md-12 form-horizontal">' +
                '<div class="form-group">' +
                '<label for="formType" class="col-md-4 control-label"> </span>表单类型:</label>' +
                '<div class="col-md-8">' +
                '<select class="form-control" id="formType" name="formType" >' +
                '<option value="" disabled selected style="display:none;">请选择</option>' +
                '<option value="0">砖混结构</option>' +
                '<option value="9">砖木结构</option>' +
                '<option value="1">多层钢筋混凝土结构</option>' +
                '<option value="2">高层结构</option>' +
                '<option value="3">工业厂房结构</option>' +
                '<option value="4">空旷结构</option>' +
                '<option value="5">土木结构</option>' +
                '<option value="6">木结构</option>' +
                '<option value="7">石结构</option>' +
                '<option value="8">其它</option>' +
                '</select>' +
                '</div>' +
                '</div>' +
                '</div>' +
                '</div>',
            buttons: buttons,
            afterOpen: function () {

            }
        });
        dialog.show();
    };
    var deleteFm = function (taskId, taskName) {
        var rows = $("#formListGrid").datagrid("getSelections");
        if (rows == null || rows.length == 0) {
            Util.alert("请选择一行数据!");
            return;
        }
        if (rows.length >= 1) {
            for (var i = 0; i < rows.length; i++) {
                if (rows[i].status == '3' || rows[i].status == '1' || rows[i].status == '5') {
                    Util.alert("只有数据状态为未提交、审核不通过、省级的才能删除!");
                    return;
                }
            }
        }
        Util.confirm("是否要删除选中的表单?", function () {
            var ids = "";
            $.each(rows, function (i, row) {
                ids += row.id + ",";
            });
            ids = ids.substr(0, ids.length - 1);
            console.log(ids)
            $.ajax({
                url: getServer() + "/fw/structure/del",
                contentType: "application/json",
                data: ids,
                type: "post",
                success: function (data) {
                    Util.alert(data.message);
                    createFormGrid(taskId, taskName);
                }
            });
        }, function () {
            return;
        });

    };
    //提交
    var submit = function (taskId, taskName) {
        var rows = $("#formListGrid").datagrid("getSelections");
        console.info(rows);
        if (rows == null || rows.length == 0) {
            Util.alert("请选择一行数据!");
            return;
        }
        if (rows.length >= 1) {
            for (var i = 0; i < rows.length; i++) {
                if (rows[i].status != '0' && rows[i].status != '4') {
                    Util.alert("只有数据状态为未提交或省级退回的才能提交!");
                    return;
                }
            }
        }

        // console.log(rows, ids)
        // 收集错误的信息
        var errorNumbers = []
        for (let k = 0; k < rows.length; k++) {
            let rowId = rows[k].id
            let rowItem = rows[k]
            let condition = rowItem.belongtoProvince && rowItem.belongtoCity && rowItem.belongtoArea
            
            if (rowItem.structureType == '0') {
            	//砖混结构
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.fortifyStandard && row.baseType && row.regularLevel && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.czType && row.roofType && row.floorType && row.wallMaterial && row.outWallThick && row.inWallThick && row.mortarType && row.mortarStrength && row.cwmgj && row.parapetInstall && row.ltjbz && row.czzPlace && row.jlInstall && row.buildingSituation && row.buildingCost
                        if (row.jlInstall != '0（未设圈梁）') {
                            condition = condition && row.jlbhqk
                        }
                    }
                })

            } else if (rowItem.structureType == '1') {
                //多层钢筋混凝土结构
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.fortifyStandard && row.structureType && row.baseType && row.regularLevel && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.zhntqdLevel && row.jlqhntqdLevel && row.roofType && row.floorType && row.fillWallMaterial && row.fillWallThickness && row.frameStyle && row.cwmgj && row.parapetHeight && row.tcjyj && row.ltjbz && row.lzSituation && row.tcqSituation && row.baseSituation && row.buildingCost
                    }
                })

            } else if (rowItem.structureType == '2') {
                // 高层结构
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.fortifyStandard && row.structuralStyle && row.baseType && row.regularLevel && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.basementFloorNum && row.skirtFloorNum && row.skirtStructuralStyle && row.colConcreteStrengthGrade && row.shearwellConcreteStrengthGrade && row.roofType && row.floorType && row.fillWallMaterial && row.wellThick && row.beamSituation && row.fillWellSituation && row.baseSituation && row.buildingCost
                    }
                })

            } else if (rowItem.structureType == '3') {
                // 工业厂房结构
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.fortifyStandard && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.structureType && row.craneType && row.isSkylight && row.ringBeamNum && row.bentFrameColType && row.bentFrameColEqual && row.bentFrameNum && row.spans && row.zdbg && row.isColumnChangeSection && row.bentFrameColSpace && row.baseSituation && row.topBentFrameSize && row.bottomBentFrameSize && row.colConcreteStrengthGrade && row.bentFrameSectionDatumMark && row.roofTrussThirdQuarterDatumMark && row.roofSystem && row.roofTrussStyle && row.hoistTon && row.wallMaterial && row.wallHeight && row.wallThick && row.wallCol && row.roofTrussFirstQuarterStigma && row.yqgqlInstall && row.parapetHeight && row.zjzc && row.zSituation && row.wmgjSituation && row.fillWellSituation && row.baseSituation && row.buildingCost
                    }
                })

            } else if (rowItem.structureType == '4') {
                // 空旷结构
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.fortifyStandard && row.regularLevel && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.wmType && row.wjGenre && row.ringBeamNum && row.colType && row.colSpan && row.colSpace && row.zzyjmSize && row.zhntqdLevel && row.zdbg && row.isColumnChangeSection && row.zbjmcbg && row.wjxxbg && row.wallMaterial && row.wallThick && row.wjdbbgc && row.yqgjlInstall && row.parapetHeight && row.wallCol && row.wtkqt && row.zjzc && row.lzSituation && row.wmgjSituation && row.fillWellSituation && row.baseSituation && row.buildingCost
                    }
                })

            } else if (rowItem.structureType == '5') {
                // 土木结构
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.baseType && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.wallType && row.qtdqStyle && row.qtyxcl && row.windowWidth && row.czqMaxSpace  && row.wallThick && row.wmStyle && row.wmMaterial && row.ysge && row.wlgljcs && row.cwmgj && row.wallRingBeam && row.buildingSituation && row.buildingCost
                    }
                })

            } else if (rowItem.structureType == '6') {
                // 木结构
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.cdType && row.zjzc && row.mzsj && row.zjyjclj && row.mzjslg && row.byteStatus && row.wallType && row.sjqtType && row.wallThick && row.cwmgj && row.wallRingBeam && row.buildingSituation && row.buildingCost
                    }
                })

            } else if (rowItem.structureType == '7') {
                // 石结构
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.wallMaterial && row.czType && row.zhqlj && row.hqzdSpace && row.sxlcjgStyle && row.hqkdArea && row.wallThick && row.roofType && row.floorType && row.cwmgj && row.ql && row.sjsgzz && row.buildingSituation && row.buildingCost
                    }
                })

            } else if (rowItem.structureType == '8') {
                // 其他
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.baseType && row.fortifyStandard && row.regularLevel && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.roofType && row.floorType && row.cwmgj && row.parapetInstall && row.buildingSituation && row.buildingCost
                    }
                })

            } else if (rowItem.structureType == '9') {
                // 砖木
                $.ajax({
                    url: getServer() + "/fw/structure/getChild/" + rowId,
                    type: "get",
                    success: function (data) {
                        console.log(data);
                        var row = data
                        condition = condition && row.belongtoStreet && row.buildingName && row.buildingAge && row.siteType && row.baseType && row.fortifyStandard && row.regularLevel && row.buildingArea && row.buildingLength && row.buildingWidth && row.floorNum && row.buildingHeight && row.roofType && row.floorType && row.cwmgj && row.parapetInstall && row.buildingSituation && row.buildingCost
                    }
                })

            }
            debugger
            if (!condition) {
                // 校验失败
                // 如果校验失败 将本次的number 收集到errorNumbers中 在弹出的提示中展示错误表单的structureNum
                errorNumbers.push(row.structureNum)
                // Util.alert('所选表单数据不完善,无法提交')
                // return
            }
        }
        // console.log(errorNumbers)
        if (errorNumbers.length) {
            let errorHtml = `样本编号为<span style='color:#ff0000'>${errorNumbers.join(',')}</span>数据不完善,无法提交`;
            Util.alert(errorHtml)
        } else {
	        Util.confirm("是否要提交选中的表单?", function () {
	            var ids = "";
	            $.each(rows, function (i, row) {
	                ids += row.id + ",";
	            });
	            ids = ids.substr(0, ids.length - 1);
	            $.ajax({
	                url: getServer() + "/fw/structure/submit",
	                contentType: "application/json",
	                data: ids,
	                type: "post",
	                success: function (data) {
	                    createFormGrid(taskId, taskName);
	                }
	            });
	        }, function () {
	            return;
	        });
	    }

    };
    //获取样本编号
    var getFormNum = function (type) {
        $.ajax({
            url: getServer() + "/fw/structure/structureCode",
            type: "get",
            success: function (data) {

                $("#brickStructureNum").val(data);
                $("#brickwoodStructureNum").val(data);
                $("#mulConcreteStructureNum").val(data);
                $("#highStructureNum").val(data);
                $("#factoryStructureNum").val(data);
                $("#wideStructureNum").val(data);
                $("#buildingStructureNum").val(data);
                $("#woodStructureNum").val(data);
                $("#stoneStructureNum").val(data);
                $("#otherStructureNum").val(data);
            }
        });
    };
    //查看表单
    window._viewForm = function (taskId, taskName, type, id, status) {
        var siftViewDataHtml = '';
        if (status == 3) {

            siftViewDataHtml = openReadonlyForm(type);
        } else {
            siftViewDataHtml = openCheckForm(type);
        }
        var slidebar = Util.slidebar({
            url: siftViewDataHtml,
            width: "900px",
            cache: false,
            close: true,
            afterLoad: function () {
                $('.selectpicker').selectpicker();
                getForm(type, id, status);
                var url;
                var dom;

                if (type == '0') {
                    url = "/fw/brick/update";
                    dom = $("#brickForm");
                    brickFormValidator();
                    $("#jlInstall").change(function () {
                        if ($(this).val() == "0（未设圈梁）") {
                            $("#jlbhqkLable").show();
                            $("#jlbhqkLableR").hide();
                            $("#jlbhqk").rules("remove");
                            $("#jlbhqkC").removeClass("has-error");
                            $("#jlbhqk + span").hide();
                        } else {
                            $("#jlbhqkLable").hide();
                            $("#jlbhqkLableR").show();
                            $("#jlbhqk").rules("add", {
                                required: true
                            });
                        }
                    });
                } else if (type == '1') {
                    url = "/fw/mulConcrete/update";
                    dom = $("#concreteForm");
                    concreteFormValidator();
                } else if (type == '2') {
                    url = "/fw/high/update";
                    dom = $("#highStructureForm");
                    highStructureFormValidator();
                } else if (type == '3') {
                    url = "/fw/factory/update";
                    dom = $("#factoryForm");
                    factoryFormValidator();
                } else if (type == '4') {
                    url = "/fw/wide/update";
                    dom = $("#wideStructureForm");
                    wideStructureFormValidator();
                } else if (type == '5') {
                    url = "/fw/building/update";
                    dom = $("#buildingForm");
                    buildingFormValidator();
                } else if (type == '6') {
                    url = "/fw/wood/update";
                    dom = $("#woodForm");
                    woodFormValidator();
                } else if (type == '7') {
                    url = "/fw/stone/update";
                    dom = $("#stoneForm");
                    stoneFormValidator();
                } else if (type == '8') {
                    url = "/fw/other/update";
                    dom = $("#otherForm");
                    otherFormValidator();
                    $("#jlInstall").change(function () {
                        if ($(this).val() == "0（未设圈梁）") {
                            $("#jlbhqkLable").show();
                            $("#jlbhqkLableR").hide();
                            $("#jlbhqk").rules("remove");
                            $("#jlbhqkC").removeClass("has-error");
                            $("#jlbhqk + span").hide();
                        } else {
                            $("#jlbhqkLable").hide();
                            $("#jlbhqkLableR").show();
                            $("#jlbhqk").rules("add", {
                                required: true
                            });
                        }
                    });
                } else if (type == '9') {
                    url = "/fw/brickwood/update";
                    dom = $("#brickwoodForm");
                    brickwoodFormValidator();
                    $("#jlInstall").change(function () {
                        if ($(this).val() == "0（未设圈梁）") {
                            $("#jlbhqkLable").show();
                            $("#jlbhqkLableR").hide();
                            $("#jlbhqk").rules("remove");
                            $("#jlbhqkC").removeClass("has-error");
                            $("#jlbhqk + span").hide();
                        } else {
                            $("#jlbhqkLable").hide();
                            $("#jlbhqkLableR").show();
                            $("#jlbhqk").rules("add", {
                                required: true
                            });
                        }
                    });
                }
                //保存（暂存） 数据状态置为 未提交 0 不做校验
                $("#holdBtn").on("click", function () {
                    
                    if (type == '0') {
                        var data = Tool.serialize("brickForm");
                        if($("#cwmgj").val()!=null){
                            data.cwmgj = $("#cwmgj").val().toString();
                        }
                    } else if (type == '1') {
                        var data = Tool.serialize("concreteForm");
                        if($("#cwmgj").val()!=null){
                            data.cwmgj = $("#cwmgj").val().toString();
                        }
                    } else if (type == '2') {
                        var data = Tool.serialize("highStructureForm");
                    } else if (type == '3') {
                        var data = Tool.serialize("factoryForm");
                    } else if (type == '4') {
                        var data = Tool.serialize("wideStructureForm");
                    } else if (type == '5') {
                        var data = Tool.serialize("buildingForm");
                    } else if (type == '6') {
                        var data = Tool.serialize("woodForm");
                    } else if (type == '7') {
                        var data = Tool.serialize("stoneForm");
                    } else if (type == '8') {
                        var data = Tool.serialize("otherForm");
                    } else if (type == '9') {
                        var data = Tool.serialize("brickwoodForm");
                        if($("#cwmgj").val()!=null){
                            data.cwmgj = $("#cwmgj").val().toString();
                        }
                    }
                    if (status != 0 && status != 2 && status != 4) {
                        Util.alert("只有数据状态为未提交、审核未通过和省级退回的的才能修改!");
                        return;
                    } else {
                        data.status = 0;
                       console.log(data.detailFile)
                        $.ajax({
                            url: getServer() + url,
                            contentType: "application/json",
                            data: JSON.stringify(data),
                            type: "post",
                            success: function (data) {
                                Util.alert(data.message);
                                slidebar.close();
                                createFormGrid(taskId, taskName);
                            }
                        });
                    }
                    
                });
                $("#isColumnChangeSection").change(function () {
                    if($(this).val()=='是'){
                        $("#zbjmcbgSpan").css("display","inline-block");
                    }
                    if($(this).val()=='否'){
                        $("#zbjmcbgSpan").css("display","none");
                    }
                });
                // 提交 数据状态置为 未审核 1 做校验
                $("#saveBtn").on("click", function () {
                    if (dom.valid()) {
                        if (type == '0') {
                            var data = Tool.serialize("brickForm");
                            if($("#cwmgj").val()!=null){
                                data.cwmgj = $("#cwmgj").val().toString();
                            }
                        } else if (type == '1') {
                            var data = Tool.serialize("concreteForm");
                            if($("#cwmgj").val()!=null){
                                data.cwmgj = $("#cwmgj").val().toString();
                            }
                        } else if (type == '2') {
                            var data = Tool.serialize("highStructureForm");
                        } else if (type == '3') {
                            var data = Tool.serialize("factoryForm");
                        } else if (type == '4') {
                            var data = Tool.serialize("wideStructureForm");
                        } else if (type == '5') {
                            var data = Tool.serialize("buildingForm");
                        } else if (type == '6') {
                            var data = Tool.serialize("woodForm");
                        } else if (type == '7') {
                            var data = Tool.serialize("stoneForm");
                        } else if (type == '8') {
                            var data = Tool.serialize("otherForm");
                        } else  if (type == '9') {
                            var data = Tool.serialize("brickwoodForm");
                            if($("#cwmgj").val()!=null){
                                data.cwmgj = $("#cwmgj").val().toString();
                            }
                        }
                        if (status != 0 && status != 2 && status != 4) {
                            Util.alert("只有数据状态为未提交、审核未通过和省级退回的的才能修改!");
                            return;
                        } else {
                            data.status = 1;
                            $.ajax({
                                url: getServer() + url,
                                contentType: "application/json",
                                data: JSON.stringify(data),
                                type: "post",
                                success: function (data) {
                                    Util.alert(data.message);
                                    slidebar.close();
                                    createFormGrid(taskId, taskName);
                                }
                            });
                        }
                    }
                });
            }
        });
    };
    var getForm = function (type, id, status) {
        $.ajax({
            url: getServer() + "/fw/structure/getChild/" + id,
            type: "get",
            success: function (data) {
                console.log(data);

                editProvince(data.belongtoProvince, data.belongtoCity, data.belongtoArea);
                //				$('#belongtoProvince').val(data.belongtoProvince);
                //				$('#belongtoCity').val(data.belongtoCity);
                //				$('#belongtoArea').val(data.belongtoArea);
                if (type == 0) {
                    debugger
                    if (data.jlInstall == "0（未设圈梁）") {
                        $("#jlbhqkLable").show();
                        $("#jlbhqkLableR").hide();
                        $("#jlbhqk").rules("remove");
                        $("#jlbhqkC").removeClass("has-error");
                        $("#jlbhqk + span").hide();
                    } else {
                        $("#jlbhqkLable").hide();
                        $("#jlbhqkLableR").show();
                        $("#jlbhqk").rules("add", {
                            required: true
                        });
                    }
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }

                    if(data.cwmgj!=null){
                        data.cwmgj = data.cwmgj.split(",");
                    }
                    Tool.deserialize("brickForm", data);
                    $('#cwmgj').selectpicker('val', data.cwmgj);

                    viewFileUpload(data.detailFile);
                } else if (type == 1) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    if(data.cwmgj!=null){
                        data.cwmgj = data.cwmgj.split(",");
                    }
                    Tool.deserialize("concreteForm", data);
                    $('#cwmgj').selectpicker('val', data.cwmgj);
                    viewFileUpload(data.detailFile);
                } else if (type == 2) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("highStructureForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 3) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("factoryForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 4) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    if(data.isColumnChangeSection=='是'){
                        $("#zbjmcbgSpan").css("display","inline-block");
                    }
                    Tool.deserialize("wideStructureForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 5) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("buildingForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 6) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("woodForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 7) {
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("stoneForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 8){
                    if (data.jlInstall == "0（未设圈梁）") {
                        $("#jlbhqkLable").show();
                        $("#jlbhqkLableR").hide();
                        $("#jlbhqk").rules("remove");
                        $("#jlbhqkC").removeClass("has-error");
                        $("#jlbhqk + span").hide();
                    } else {
                        $("#jlbhqkLable").hide();
                        $("#jlbhqkLableR").show();
                        $("#jlbhqk").rules("add", {
                            required: true
                        });
                    }
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }
                    Tool.deserialize("otherForm", data);
                    viewFileUpload(data.detailFile);
                } else if (type == 9) {
                    debugger
                    if (data.jlInstall == "0（未设圈梁）") {
                        $("#jlbhqkLable").show();
                        $("#jlbhqkLableR").hide();
                        $("#jlbhqk").rules("remove");
                        $("#jlbhqkC").removeClass("has-error");
                        $("#jlbhqk + span").hide();
                    } else {
                        $("#jlbhqkLable").hide();
                        $("#jlbhqkLableR").show();
                        $("#jlbhqk").rules("add", {
                            required: true
                        });
                    }
                    if (status == 2) {
                        $('#unapproval_reason').show();
                        $("#reason").val(data.checkOpinion);
                    }

                    if(data.cwmgj!=null){
                        data.cwmgj = data.cwmgj.split(",");
                    }
                    Tool.deserialize("brickwoodForm", data);
                    $('#cwmgj').selectpicker('val', data.cwmgj);

                    viewFileUpload(data.detailFile);
                }

            }
        });
    };
    var brickFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#brickForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                czType: {
                    required: true
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                wallMaterial: {
                    required: true
                },
                outWallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                inWallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                mortarType: {
                    required: true
                },
                mortarStrength: {
                    required: true
                },
                cwmgj: {
                    required: true
                },
                parapetInstall: {
                    required: true
                },
                ltjbz: {
                    required: true
                },
                czzPlace: {
                    required: true
                },
                jlInstall: {
                    required: true
                },
                jlbhqk: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                czType: {
                    required: "请选择承重方式"
                },
                roofType: {
                    required: "请选择屋盖类别"
                },
                floorType: {
                    required: "请选择楼盖类别"
                },
                wallMaterial: {
                    required: "请选择墙体材质"
                },
                outWallThick: {
                    required: "请填写外墙厚度"
                },
                inWallThick: {
                    required: "请填写内墙厚度"
                },
                mortarType: {
                    required: "请选择砂浆类型"
                },
                mortarStrength: {
                    required: "请选择砂浆强度"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                parapetInstall: {
                    required: "请选择女儿墙设置"
                },
                ltjbz: {
                    required: "请选择楼梯间布置"
                },
                czzPlace: {
                    required: "请选择构造柱位置"
                },
                jlInstall: {
                    required: "请选择圈梁设置"
                },
                jlbhqk: {
                    required: "请选择圈梁闭合情况"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var brickwoodFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#brickwoodForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                czType: {
                    required: true
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                wallMaterial: {
                    required: true
                },
                outWallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                inWallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                mortarType: {
                    required: true
                },
                mortarStrength: {
                    required: true
                },
                cwmgj: {
                    required: true
                },
                parapetInstall: {
                    required: true
                },
                ltjbz: {
                    required: true
                },
                czzPlace: {
                    required: true
                },
                jlInstall: {
                    required: true
                },
                jlbhqk: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                czType: {
                    required: "请选择承重方式"
                },
                roofType: {
                    required: "请选择屋盖类别"
                },
                floorType: {
                    required: "请选择楼盖类别"
                },
                wallMaterial: {
                    required: "请选择墙体材质"
                },
                outWallThick: {
                    required: "请填写外墙厚度"
                },
                inWallThick: {
                    required: "请填写内墙厚度"
                },
                mortarType: {
                    required: "请选择砂浆类型"
                },
                mortarStrength: {
                    required: "请选择砂浆强度"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                parapetInstall: {
                    required: "请选择女儿墙设置"
                },
                ltjbz: {
                    required: "请选择楼梯间布置"
                },
                czzPlace: {
                    required: "请选择构造柱位置"
                },
                jlInstall: {
                    required: "请选择圈梁设置"
                },
                jlbhqk: {
                    required: "请选择圈梁闭合情况"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var concreteFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#concreteForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                structureType: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                zhntqdLevel: {
                    required: true
                },
                zdzSpan: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                zdlkd: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                jlqhntqdLevel: {
                    required: true
                },
                jlqzdSpan: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                fillWallMaterial: {
                    required: true
                },
                fillWallThickness: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                frameStyle: {
                    required: true
                },
                mortarType: {
                    required: true
                },
                mortarStrength: {
                    required: true
                },
                cwmgj: {
                    required: true
                },
                parapetHeight: {
                    required: true
                },
                tcjyj: {
                    required: true
                },
                ltjbz: {
                    required: true
                },
                lzSituation: {
                    required: true
                },
                tcqSituation: {
                    required: true
                },
                baseSituation: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                structureType: {
                    required: "请选择结构形式"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                zhntqdLevel: {
                    required: "请选择柱混凝土强度等级"
                },
                jlqhntqdLevel: {
                    required: "请选择剪力墙混凝土强度等级"
                },
                roofType: {
                    required: "请选择屋盖类别"
                },
                floorType: {
                    required: "请选择楼盖类别"
                },
                fillWallMaterial: {
                    required: "请选择填充墙体材质"
                },
                fillWallThickness: {
                    required: "请填写填充墙厚度"
                },
                frameStyle: {
                    required: "请选择框架形式"
                },
                mortarType: {
                    required: "请选择砂浆类型"
                },
                mortarStrength: {
                    required: "请选择砂浆强度"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                parapetHeight: {
                    required: "请选择女儿墙高度"
                },
                tcjyj: {
                    required: "请选择填充墙与柱"
                },
                ltjbz: {
                    required: "请选择楼梯间布置"
                },
                lzSituation: {
                    required: "请选择梁柱现状"
                },
                tcqSituation: {
                    required: "请选择填充墙现状"
                },
                baseSituation: {
                    required: "请选择基础现状"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var highStructureFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#highStructureForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                structureType: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                basementFloorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                skirtFloorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                skirtStructuralStyle: {
                    required: true
                },
                colConcreteStrengthGrade: {
                    required: true
                },
                maxColSpace: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                maxPurlinSpace: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                shearwellConcreteStrengthGrade: {
                    required: true
                },
                maxShearwellSpace: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                fillWallMaterial: {
                    required: true
                },
                wellThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                beamSituation: {
                    required: true
                },
                fillWellSituation: {
                    required: true
                },
                baseSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                structureType: {
                    required: "请选择结构形式"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                basementFloorNum: {
                    required: "请填写地下室层数"
                },
                skirtFloorNum: {
                    required: "请填写裙房层数"
                },
                skirtStructuralStyle: {
                    required: "请选择裙房结构形式"
                },
                colConcreteStrengthGrade: {
                    required: "请选择柱混凝土强度等级"
                },
                shearwellConcreteStrengthGrade: {
                    required: "请选择剪力墙混凝土强度等级"
                },
                roofType: {
                    required: "请选择屋盖类别"
                },
                floorType: {
                    required: "请选择楼盖类别"
                },
                fillWallMaterial: {
                    required: "请选择填充墙体材质"
                },
                wellThick: {
                    required: "请填写填充墙厚度"
                },
                beamSituation: {
                    required: "请选择梁柱现状"
                },
                fillWellSituation: {
                    required: "请选择填充墙现状"
                },
                baseSituation: {
                    required: "请选择基础现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var factoryFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#factoryForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                structureType: {
                    required: true
                },
                craneType: {
                    required: true
                },
                isSkylight: {
                    required: true
                },
                ringBeamNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                bentFrameColType: {
                    required: true
                },
                bentFrameColEqual: {
                    required: true
                },
                bentFrameNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                spans: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                zdbg: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                isColumnChangeSection: {
                    required: true
                },
                bentFrameColSpace: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                topBentFrameSize: {
                    required: true
                },
                bottomBentFrameSize: {
                    required: true
                },
                colConcreteStrengthGrade: {
                    required: true
                },
                bentFrameSectionDatumMark: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofTrussThirdQuarterDatumMark: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofSystem: {
                    required: true
                },
                roofTrussStyle: {
                    required: true
                },
                hoistTon: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallMaterial: {
                    required: true
                },
                wallHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallCol: {
                    required: true
                },
                roofTrussFirstQuarterStigma: {
                    required: true
                },
                yqgqlInstall: {
                    required: true
                },
                parapetHeight: {
                    required: true
                },
                zjzc: {
                    required: true
                },
                zSituation: {
                    required: true
                },
                wmgjSituation: {
                    required: true
                },
                fillWellSituation: {
                    required: true
                },
                baseSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                structureType: {
                    required: "请选择结构类型"
                },
                craneType: {
                    required: "请选择吊车类型"
                },
                isSkylight: {
                    required: "请选择有无天窗"
                },
                ringBeamNum: {
                    required: "请填写圈梁道数"
                },
                bentFrameColType: {
                    required: "请选择排架柱类型"
                },
                bentFrameColEqual: {
                    required: "请选择排架柱是否等高"
                },
                bentFrameNum: {
                    required: "请填写排架跨数"
                },
                spans: {
                    required: "请填写各跨跨度"
                },
                zdbg: {
                    required: "请填写柱顶标高"
                },
                isColumnChangeSection: {
                    required: "请选择柱是否变截面"
                },
                bentFrameColSpace: {
                    required: "请填写排架柱距"
                },
                topBentFrameSize: {
                    required: "请填写排架柱上柱主要截面尺寸"
                },
                bottomBentFrameSize: {
                    required: "请填写排架柱下柱主要截面尺寸"
                },
                colConcreteStrengthGrade: {
                    required: "请选择柱混凝土强度等级"
                },
                bentFrameSectionDatumMark: {
                    required: "请填写排架柱变截面处标高"
                },
                roofTrussThirdQuarterDatumMark: {
                    required: "请填写屋架下弦标高"
                },
                roofSystem: {
                    required: "请选择屋盖体系"
                },
                roofTrussStyle: {
                    required: "请填写屋架形式"
                },
                hoistTon: {
                    required: "请填写吊车吨位"
                },
                wallMaterial: {
                    required: "请选择围护墙体材质"
                },
                wallHeight: {
                    required: "请填写围护墙体高度"
                },
                wallThick: {
                    required: "请填写围护墙体厚度"
                },
                wallCol: {
                    required: "请选择围护墙与柱拉结构造"
                },
                roofTrussFirstQuarterStigma: {
                    required: "请选择屋架端部上弦和柱顶圈梁设置"
                },
                yqgqlInstall: {
                    required: "请选择沿墙高圈梁设置"
                },
                parapetHeight: {
                    required: "请选择女儿墙高度"
                },
                zjzc: {
                    required: "请选择柱间支撑"
                },
                zSituation: {
                    required: "请选择柱现状"
                },
                wmgjSituation: {
                    required: "请选择屋面构件现状"
                },
                fillWellSituation: {
                    required: "请选择填充墙现状"
                },
                baseSituation: {
                    required: "请选择基础现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };

    var wideStructureFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        jQuery.validator.addMethod("isTrue", function (value, element) {
            if($("#isColumnChangeSection").val()!=null && $("#isColumnChangeSection").val()=='是'){
                if($("#zbjmcbg").val()==''){
                    console.info("11")
                    return false;
                }else{
                    console.info("22")
                    return true;
                }
            }else if($("#isColumnChangeSection").val()!=null && $("#isColumnChangeSection").val()=='否'){
                return true;
            }
        }, "柱是否变截面为是时,柱变截面处标高不能为空");
        $("#wideStructureForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                structureType: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                naturalVibrationPeriod: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wmType: {
                    required: true
                },
                wjGenre: {
                    required: true
                },
                ringBeamNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                colType: {
                    required: true
                },
                colSpan: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                colSpace: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                zzyjmSize: {
                    required: true
                },
                zhntqdLevel: {
                    required: true
                },
                zdbg: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                isColumnChangeSection: {
                    required: true
                },
                zbjmcbg: {
                    required: false,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true, //调用自定义验证
                    isTrue:true
                },
                wjxxbg: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallMaterial: {
                    required: true
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wjdbbgc: {
                    required: true
                },
                yqgjlInstall: {
                    required: true
                },
                parapetHeight: {
                    required: true
                },
                wallCol: {
                    required: true
                },
                wtkqt: {
                    required: true
                },
                zjzc: {
                    required: true
                },
                lzSituation: {
                    required: true
                },
                wmgjSituation: {
                    required: true
                },
                fillWellSituation: {
                    required: true
                },
                baseSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                structureType: {
                    required: "请选择结构形式"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                wmType: {
                    required: "请选择屋面类别"
                },
                wjGenre: {
                    required: "请填写屋架形式"
                },
                ringBeamNum: {
                    required: "请填写圈梁道数"
                },
                colType: {
                    required: "请选择柱类型"
                },
                colSpan: {
                    required: "请填写柱跨度"
                },
                colSpace: {
                    required: "请填写柱距"
                },
                zzyjmSize: {
                    required: "请填写柱主要界面尺寸"
                },
                zhntqdLevel: {
                    required: "请选择柱混凝土强度等级"
                },
                zdbg: {
                    required: "请填写柱顶标高"
                },
                isColumnChangeSection: {
                    required: "请选择柱是否变截面"
                },
                zbjmcbg: {
                    required: "请填写柱变截面处标高"
                },
                wjxxbg: {
                    required: "请填写屋架下弦标高"
                },
                wallMaterial: {
                    required: "请选择围护墙体材质"
                },
                wallThick: {
                    required: "请填写填充墙厚度"
                },
                wjdbbgc: {
                    required: "请选择屋架底部标高处圈梁设置"
                },
                yqgjlInstall: {
                    required: "请选择沿墙高圈梁设置"
                },
                parapetHeight: {
                    required: "请选择女儿墙高度"
                },
                wallCol: {
                    required: "请选择围护墙与柱拉结情况"
                },
                wtkqt: {
                    required: "请选择舞台口墙体"
                },
                zjzc: {
                    required: "请选择柱间支撑"
                },
                lzSituation: {
                    required: "请选择梁柱现状"
                },
                wmgjSituation: {
                    required: "请选择屋面构件现状"
                },
                fillWellSituation: {
                    required: "请选择填充墙现状"
                },
                baseSituation: {
                    required: "请选择基础现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var buildingFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#buildingForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallType: {
                    required: true
                },
                qtdqStyle: {
                    required: true
                },
                qtyxcl: {
                    required: true
                },
                windowWidth: {
                    required: true
                },
                czqMaxSpace: {
                    required: true
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wmStyle: {
                    required: true
                },
                wmMaterial: {
                    required: true
                },
                ysge: {
                    required: true
                },
                wlgljcs: {
                    required: true
                },
                cwmgj: {
                    required: true
                },
                wallRingBeam: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                wallType: {
                    required: "请选择墙体类型"
                },
                qtdqStyle: {
                    required: "请选择墙体砌筑方式"
                },
                qtyxcl: {
                    required: "请选择墙体延性材料"
                },
                windowWidth: {
                    required: "请选择门窗洞口宽度"
                },
                czqMaxSpace: {
                    required: "请选择承重墙最大间距"
                },
                wallThick: {
                    required: "请填写墙体厚度"
                },
                wmStyle: {
                    required: "请选择屋面形式"
                },
                wmMaterial: {
                    required: "请选择屋面材料"
                },
                ysge: {
                    required: "请选择硬山搁檩"
                },
                wlgljcs: {
                    required: "请选择屋、楼盖拉结措施"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                wallRingBeam: {
                    required: "请选择墙体圈梁"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var woodFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#woodForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                cdType: {
                    required: true
                },
                zjzc: {
                    required: true
                },
                mzsj: {
                    required: true
                },
                zjyjclj: {
                    required: true
                },
                mzjslg: {
                    required: true
                },
                byteStatus: {
                    required: true
                },
                wallType: {
                    required: true
                },
                sjqtType: {
                    required: true
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                cwmgj: {
                    required: true
                },
                wallRingBeam: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                cdType: {
                    required: "请选择穿斗方式"
                },
                zjzc: {
                    required: "请选择柱间支撑"
                },
                mzsj: {
                    required: "请选择木柱梢径"
                },
                zjyjclj: {
                    required: "请选择柱脚与基础连接"
                },
                mzjslg: {
                    required: "请选择木柱接榫牢固"
                },
                byteStatus: {
                    required: "请选择节点状态"
                },
                wallType: {
                    required: "请选择围护墙体类型"
                },
                sjqtType: {
                    required: "请选择山尖墙体类型"
                },
                wallThick: {
                    required: "请填写墙体厚度"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                wallRingBeam: {
                    required: "请选择墙体圈梁"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var stoneFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#stoneForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 100
                },
                buildingName: {
                    required: true,
                    maxlength: 100
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                wallMaterial: {
                    required: true
                },
                czType: {
                    required: true
                },
                zhqlj: {
                    required: true
                },
                hqzdSpace: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                sxlcjgStyle: {
                    required: true
                },
                hqkdArea: {
                    required: true
                },
                wallThick: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                cwmgj: {
                    required: true
                },
                ql: {
                    required: true
                },
                sjsgzz: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过100"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过100"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                wallMaterial: {
                    required: "请选择墙体材质"
                },
                czType: {
                    required: "请选择承重方式"
                },
                zhqlj: {
                    required: "请选择纵横墙连接"
                },
                hqzdSpace: {
                    required: "请填写横墙最大间距"
                },
                sxlcjgStyle: {
                    required: "请选择上下楼层结构形式"
                },
                hqkdArea: {
                    required: "请选择横墙开洞面积"
                },
                wallThick: {
                    required: "请填写墙体厚度"
                },
                roofType: {
                    required: "请选择屋盖类型"
                },
                floorType: {
                    required: "请选择楼盖类型"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                ql: {
                    required: "请选择圈梁"
                },
                sjsgzz: {
                    required: "请选择四角设构造柱"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var otherFormValidator = function () {
        //自定义validate验证输入的数字小数点位数不能大于一位
        jQuery.validator.addMethod("oneNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{1}){0,1}$/.test(value);
        }, "保留一位小数"); //验证错误信息
        jQuery.validator.addMethod("twoNumber", function (value, element) {
            return this.optional(element) || /^[0-9]+([.][0-9]{2}){0,2}$/.test(value);
        }, "保留两位小数"); //验证错误信息
        jQuery.validator.addMethod("isInteger", function (value, element) {
            return this.optional(element) || (/^[-\+]?\d+$/.test(value) && parseInt(value) >= 0);
        }, "必须为正整数");
        $("#otherForm").validate({
            rules: {
                belongtoProvince: {
                    required: true
                },
                belongtoCity: {
                    required: true
                },
                belongtoArea: {
                    required: true
                },
                belongtoStreet: {
                    required: true,
                    maxlength: 20
                },
                buildingName: {
                    required: true,
                    maxlength: 50
                },
                buildingAge: {
                    required: true
                },
                siteType: {
                    required: true
                },
                baseType: {
                    required: true
                },
                fortifyStandard: {
                    required: true
                },
                regularLevel: {
                    required: true
                },
                buildingArea: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingLength: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                buildingWidth: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                floorNum: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0,
                    isInteger: true //调用自定义验证
                },
                buildingHeight: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.1,
                    oneNumber: true //调用自定义验证
                },
                roofType: {
                    required: true
                },
                floorType: {
                    required: true
                },
                cwmgj: {
                    required: true
                },
                parapetInstall: {
                    required: true
                },
                jlInstall: {
                    required: true
                },
                jlbhqk: {
                    required: true
                },
                buildingSituation: {
                    required: true
                },
                buildingCost: {
                    required: true,
                    number: true, //输入必须是数字
                    min: 0.01,
                    twoNumber: true //调用自定义验证
                }
            },
            messages: {
                belongtoProvince: {
                    required: "请选择所属省份"
                },
                belongtoCity: {
                    required: "请选择所属地区市"
                },
                belongtoArea: {
                    required: "请选择所属区县"
                },
                belongtoStreet: {
                    required: "请填写所属乡镇街道",
                    maxlength: "长度不可以超过20"
                },
                buildingName: {
                    required: "请填写样本建筑名称",
                    maxlength: "长度不可以超过50"
                },
                buildingAge: {
                    required: "请选择建造年代"
                },
                siteType: {
                    required: "请选择场地类型"
                },
                baseType: {
                    required: "请选择基础类型"
                },
                fortifyStandard: {
                    required: "请选择设防标准"
                },
                regularLevel: {
                    required: "请选择规则程度"
                },
                buildingArea: {
                    required: "请填写建筑面积"
                },
                buildingLength: {
                    required: "请填写建筑长度"
                },
                buildingWidth: {
                    required: "请填写建筑宽度"
                },
                floorNum: {
                    required: "请填写结构的主体层数"
                },
                buildingHeight: {
                    required: "请填写建筑高度"
                },
                roofType: {
                    required: "请选择屋盖类别"
                },
                floorType: {
                    required: "请选择楼盖类别"
                },
                cwmgj: {
                    required: "请选择出屋面构件"
                },
                parapetInstall: {
                    required: '请选择女儿墙设置'
                },
                jlInstall: {
                    required: "请选择圈梁设置"
                },
                jlbhqk: {
                    required: "请选择圈梁闭合情况"
                },
                buildingSituation: {
                    required: "请选择建筑现状"
                },
                buildingCost: {
                    required: "请填写建筑造价/重置单价"
                }
            }
        });
    };
    var FILE_TYPES = {
        image: {
            title: '图片文件',
            extensions: 'jpg,jpeg,bmp,png,ico',
            mimeTypes: 'image/bmp,image/jpeg,image/png,image/x-icon'
        },
        doc: {
            title: '文档文件',
            extensions: 'doc,docx,xls,xlsx,ppt,pptx,pdf',
            mimeTypes: 'application/vnd.ms-excel.12,application/vnd.ms-word.document.12,application/vnd.ms-powerpoint.12,' +
                'application/pdf,application/vnd.ms-excel,application/vnd.ms-powerpoint,application/msword'
        },
        video: {
            title: '视频文件',
            extensions: 'mp4,avi,mov,mpg',
            mimeTypes: 'video/mpeg,video/quicktime,video/x-msvideo,' +
                'application/vnd.rn-realmedia-vbr,video/mp4'
        },
        audio: {
            title: '音频文件',
            extensions: 'wma,mp3,wav',
            mimeTypes: 'audio/x-ms-wma,audio/mpeg,audio/x-wav'
        },
        packet: {
            titil: '压缩包',
            extensions: 'zip,rar',
            mimeTypes: 'application/zip,application/x-rar-compressed'
        }
    };
    var fileUpload = function () {
        require(['UtilDir/fileupload/multiFileUpload'], function (MFU) {
            var attachId = "";
            var settings = {
                placeAt: "multiFileUpload",
                allowMC: false,
                fileSizeLimit: 1024 * 1024 * 1024,
                /*
	            1.0.2版本新增
	            extendColumn:[
	                {name:"文件分类",filed:"category",format:function(file){return file.name}},
	                {name:"备注",filed:"remark",format:function(file){return '机密'}}
	            ],*/
                //data:["5a50d697c0af806aa01e06120d04f977","6c01e4492f264befab4c0532811f8dff"],
                onUploadSuccess: function (file) {
                    attachId += file.attachId + ",";
                    $("#detailFile").val(attachId.substr(0, attachId.length - 1));
                },
                onDeleteSavedFile: function (file) {
                    //console.log(file)
                }
            };
            var MFUpload = MFU.init(settings);

        });
    };
    var viewFileUpload = function (fileData) {
        require(['UtilDir/fileupload/multiFileUpload'], function (MFU) {
            var attachIdData = "";
            var attachId = "";
            var fileArray = "";
            // fileData判空
            if (fileData != null && fileData.length != 0) {
                fileArray = fileData.split(',');
                attachIdData = fileData.split(',');
            }
            var settings = {
                placeAt: "multiFileUpload",
                allowMC: false,
                fileSizeLimit: 1024 * 1024 * 1024,
                data: attachIdData,
                onUploadSuccess: function (file) {
                    attachId += file.attachId + ",";
                    if (fileData != null && fileData.length != 0) {
                        $("#detailFile").val(fileData + "," + attachId.substr(0, attachId.length - 1));
                    } else {
                        $("#detailFile").val(attachId.substr(0, attachId.length - 1));
                    }

                },
                onDeleteSavedFile: function (file) {
                    var index = fileArray.indexOf(file.attachId);
                    fileArray.splice(index, 1);
                    $("#detailFile").val(fileArray.toString());
                }
            };
            var MFUpload = MFU.init(settings);

        });
    };
    var openForm = function (type, taskId, taskName) {
        var siftCheckDataHtml = openCheckForm(type);
        var slidebar = Util.slidebar({
            url: siftCheckDataHtml,
            width: "900px",
            cache: false,
            close: true,
            afterLoad: function () {
                $('.selectpicker').selectpicker();
                createProvince();
                getFormNum(type);
                $("#taskId").val(taskId);
                $("#taskName1").val(taskName);

                var url;
                var dom;
                fileUpload();

                if (type == '0') {
                    url = "/fw/brick/save";
                    dom = $("#brickForm");
                    brickFormValidator();
                    $("#jlInstall").change(function () {
                        if ($(this).val() == "0（未设圈梁）") {
                            $("#jlbhqkLable").show();
                            $("#jlbhqkLableR").hide();
                            $("#jlbhqk").rules("remove");
                            $("#jlbhqkC").removeClass("has-error");
                            $("#jlbhqk + span").hide();
                        } else {
                            $("#jlbhqkLable").hide();
                            $("#jlbhqkLableR").show();
                            $("#jlbhqk").rules("add", {
                                required: true
                            });
                        }

                    });
                } else if (type == '1') {
                    url = "/fw/mulConcrete/save";
                    dom = $("#concreteForm");
                    concreteFormValidator();
                    $("#structureType").change(function () {
                        if ($(this).val() == "剪力墙结构") {
                            $('.checkCharacter').css('visibility', 'hidden');
                            $('.shearwellThickness').html("<span class=\"requird\">*</span>剪力墙厚度(毫米):");
                            $("#zhntqdLevel").rules("remove");
                            $("#zhntqdLevel + span").hide();
                            $("#fillWallThickness").rules("remove");
                            $("#fillWallThickness + span").hide();
                            $("#shearwellThickness").rules("add", {
                                required: true,
                                messages:{
                                    required: '请填写剪力墙厚度',
                                }
                            });
                            $("#shearwellThickness + span").show();
                            $(".showOrHide").removeClass("has-error");
                            $(".span").addClass("has-error");
                        } else {
                            $('.checkCharacter').css('visibility', 'visible');
                            $('.shearwellThickness').html("剪力墙厚度(毫米):");
                            $("#zhntqdLevel").rules("add", {
                                required: true
                            });
                            $("#fillWallThickness").rules("add", {
                                required: true
                            });
                            $("#shearwellThickness").rules("remove");
                            $(".span").removeClass("has-error");
                        }
                    });
                } else if (type == '2') {
                    url = "/fw/high/save";
                    dom = $("#highStructureForm");
                    highStructureFormValidator();
                } else if (type == '3') {
                    url = "/fw/factory/save";
                    dom = $("#factoryForm");
                    factoryFormValidator();
                } else if (type == '4') {
                    url = "/fw/wide/save";
                    dom = $("#wideStructureForm");
                    wideStructureFormValidator();
                } else if (type == '5') {
                    url = "/fw/building/save";
                    dom = $("#buildingForm");
                    buildingFormValidator();
                } else if (type == '6') {
                    url = "/fw/wood/save";
                    dom = $("#woodForm");
                    woodFormValidator();
                } else if (type == '7') {
                    url = "/fw/stone/save";
                    dom = $("#stoneForm");
                    stoneFormValidator();
                } else if (type == '8') {
                    url = "/fw/other/save";
                    dom = $("#otherForm");
                    otherFormValidator();
                    $("#jlInstall").change(function () {
                        if ($(this).val() == "0（未设圈梁）") {
                            $("#jlbhqkLable").show();
                            $("#jlbhqkLableR").hide();
                            $("#jlbhqk").rules("remove");
                            $("#jlbhqkC").removeClass("has-error");
                            $("#jlbhqk + span").hide();
                        } else {
                            $("#jlbhqkLable").hide();
                            $("#jlbhqkLableR").show();
                            $("#jlbhqk").rules("add", {
                                required: true
                            });
                        }

                    });
                } else if (type == '9') {
                    url = "/fw/brickwood/save";
                    dom = $("#brickwoodForm");
                    brickwoodFormValidator();
                    $("#jlInstall").change(function () {
                        if ($(this).val() == "0（未设圈梁）") {
                            $("#jlbhqkLable").show();
                            $("#jlbhqkLableR").hide();
                            $("#jlbhqk").rules("remove");
                            $("#jlbhqkC").removeClass("has-error");
                            $("#jlbhqk + span").hide();
                        } else {
                            $("#jlbhqkLable").hide();
                            $("#jlbhqkLableR").show();
                            $("#jlbhqk").rules("add", {
                                required: true
                            });
                        }

                    });
                }
                $("#isColumnChangeSection").change(function () {
                    if($(this).val()=='是'){
                        $("#zbjmcbgSpan").css("display","inline-block");
                    }
                    if($(this).val()=='否'){
                        $("#zbjmcbgSpan").css("display","none");
                    }
                });
                //保存（暂存） 数据状态置为 未提交 0 不做校验
                $("#holdBtn").on("click", function () {
                    
                    if (type == '0') {
                        var data = Tool.serialize("brickForm");
                        if($("#cwmgj").val()!=null){
                            data.cwmgj = $("#cwmgj").val().toString();
                        }
                    } else if (type == '1') {
                        var data = Tool.serialize("concreteForm");
                        if($("#cwmgj").val()!=null){
                            data.cwmgj = $("#cwmgj").val().toString();
                        }
                    } else if (type == '2') {
                        var data = Tool.serialize("highStructureForm");
                    } else if (type == '3') {
                        var data = Tool.serialize("factoryForm");
                    } else if (type == '4') {
                        var data = Tool.serialize("wideStructureForm");
                    } else if (type == '5') {
                        var data = Tool.serialize("buildingForm");
                    } else if (type == '6') {
                        var data = Tool.serialize("woodForm");
                    } else if (type == '7') {
                        var data = Tool.serialize("stoneForm");
                    } else if (type == '8') {
                        var data = Tool.serialize("otherForm");
                    } else if (type == '9') {
                        var data = Tool.serialize("brickwoodForm");
                        if($("#cwmgj").val()!=null){
                            data.cwmgj = $("#cwmgj").val().toString();
                        }
                    }
                    data.status = 0;
                    $.ajax({
                        url: getServer() + url,
                        contentType: "application/json",
                        data: JSON.stringify(data),
                        type: "post",
                        success: function (data) {
                            Util.alert(data.message);
                            slidebar.close();
                            createFormGrid(taskId, taskName);
                        }
                    });
                    
                });
                // 提交 数据状态置为 未审核 1 做校验
                $("#saveBtn").on("click", function () {
                    if (dom.valid()) {
                        if (type == '0') {
                            var data = Tool.serialize("brickForm");
                            data.cwmgj = $("#cwmgj").val().toString();
                        } else if (type == '1') {
                            var data = Tool.serialize("concreteForm");
                            data.cwmgj = $("#cwmgj").val().toString();
                        } else if (type == '2') {
                            var data = Tool.serialize("highStructureForm");
                        } else if (type == '3') {
                            var data = Tool.serialize("factoryForm");
                        } else if (type == '4') {
                            var data = Tool.serialize("wideStructureForm");
                        } else if (type == '5') {
                            var data = Tool.serialize("buildingForm");
                        } else if (type == '6') {
                            var data = Tool.serialize("woodForm");
                        } else if (type == '7') {
                            var data = Tool.serialize("stoneForm");
                        } else if (type == '8') {
                            var data = Tool.serialize("otherForm");
                        } else if (type == '9') {
                            var data = Tool.serialize("brickwoodForm");
                            data.cwmgj = $("#cwmgj").val().toString();
                        }
                        data.status = 1;
                        console.log(data.status)
                        console.log(url)
                        $.ajax({
                            url: getServer() + url,
                            contentType: "application/json",
                            data: JSON.stringify(data),
                            type: "post",
                            success: function (data) {
                                Util.alert(data.message);
                                slidebar.close();
                                createFormGrid(taskId, taskName);
                            }
                        });
                    }
                });
            }
        });
    };
    var createProvince = function () {
        var html = "";
        $("#belongtoCity").append(html);
        $("#belongtoArea").append(html);
        $.ajax({
            url: "/app/divisions/root/subdivisions",
            contentType: "application/json",
            type: "get",
            success: function (data) {
                $.each(data, function (idx, item) {
                    html += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                });
                $("#belongtoProvince").append(html);
            }
        });
        $("#belongtoProvince").change(function () {
            var html = '<option value="" disabled selected style="display:none;">请选择</option>';
            $("#belongtoCity option").remove();
            $("#belongtoCity").append(html);
            $("#belongtoArea option").remove();
            $("#belongtoArea").append(html);
            var divisionId = $(this).find("option:selected").attr("exid");
            if ($(this).val() == "北京市" || $(this).val() == "天津市" || $(this).val() == "上海市" || $(this).val() == "重庆市") {
                $("#belongtoCity").append("<option value='" + $(this).val() + "' exid='" + divisionId + "'>" + $(this).val() + "</option>");
                return;
            }
            $.ajax({
                url: "/app/divisions/" + divisionId + "/subdivisions",
                contentType: "application/json",
                type: "get",
                success: function (data) {
                    $.each(data, function (idx, item) {
                        html += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                    });
                    $("#belongtoCity").append(html);
                }
            });
        });
        $("#belongtoCity").change(function () {
            if ($(this).val() == "") return;
            var html = '<option value="" disabled selected style="display:none;">请选择</option>';
            $("#belongtoArea option").remove();
            $("#belongtoArea").append(html);
            var divisionId = $(this).find("option:selected").attr("exid");
            $.ajax({
                url: "/app/divisions/" + divisionId + "/subdivisions",
                contentType: "application/json",
                type: "get",
                success: function (data) {
                    $.each(data, function (idx, item) {
                        html += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                    });
                    $("#belongtoArea").append(html);
                }
            });
        });
    }
    var editProvince = function (Province, City, Area) {
        var html = "";
        $("#belongtoCity").append(html);
        $("#belongtoArea").append(html);
        $.ajax({
            url: "/app/divisions/root/subdivisions",
            contentType: "application/json",
            type: "get",
            success: function (data) {
                $.each(data, function (idx, item) {
                    if (item.divisionName == Province) {
                        var divisionId = item.divisionId;
                        var htmlCity = '';
                        if (Province == "北京市" || Province == "天津市" || Province == "上海市" || Province == "重庆市") {
                            $("#belongtoCity").append("<option value='" + Province + "' exid='" + divisionId + "'>" + Province + "</option>");
                            $('#belongtoCity').val(City);
                            var htmlArea = '';
                            $.ajax({
                                url: "/app/divisions/" + divisionId + "/subdivisions",
                                contentType: "application/json",
                                type: "get",
                                success: function (data) {
                                    $.each(data, function (idx, item) {
                                        htmlArea += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                                    });
                                    $("#belongtoArea").append(htmlArea);
                                    $('#belongtoArea').val(Area);
                                }
                            });

                        } else {
                            $.ajax({
                                url: "/app/divisions/" + divisionId + "/subdivisions",
                                contentType: "application/json",
                                type: "get",
                                success: function (data) {
                                    $.each(data, function (idx, item) {
                                        if (item.divisionName == City) {
                                            var divisionId = item.divisionId;
                                            var htmlArea = '';
                                            $.ajax({
                                                url: "/app/divisions/" + divisionId + "/subdivisions",
                                                contentType: "application/json",
                                                type: "get",
                                                success: function (data) {
                                                    $.each(data, function (idx, item) {
                                                        htmlArea += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                                                    });
                                                    $("#belongtoArea").append(htmlArea);
                                                    $('#belongtoArea').val(Area);
                                                }
                                            });
                                        }
                                        htmlCity += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                                    });
                                    $("#belongtoCity").append(htmlCity);
                                    $('#belongtoCity').val(City);
                                }
                            });
                        }
                    }
                    html += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                });
                $("#belongtoProvince").append(html);
                $('#belongtoProvince').val(Province);
            }
        });
        $("#belongtoProvince").change(function () {
            var html = '<option value="" disabled selected style="display:none;">请选择</option>';
            $("#belongtoCity option").remove();
            $("#belongtoCity").append(html);
            $("#belongtoArea option").remove();
            $("#belongtoArea").append(html);
            var divisionId = $(this).find("option:selected").attr("exid");
            if ($(this).val() == "北京市" || $(this).val() == "天津市" || $(this).val() == "上海市" || $(this).val() == "重庆市") {
                $("#belongtoCity").append("<option value='" + $(this).val() + "' exid='" + divisionId + "'>" + $(this).val() + "</option>");
                return;
            }
            $.ajax({
                url: "/app/divisions/" + divisionId + "/subdivisions",
                contentType: "application/json",
                type: "get",
                success: function (data) {
                    $.each(data, function (idx, item) {
                        html += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                    });
                    $("#belongtoCity").append(html);
                }
            });
        });
        $("#belongtoCity").change(function () {
            if ($(this).val() == "") return;
            var html = '<option value="" disabled selected style="display:none;">请选择</option>';
            $("#belongtoArea option").remove();
            $("#belongtoArea").append(html);
            var divisionId = $(this).find("option:selected").attr("exid");
            $.ajax({
                url: "/app/divisions/" + divisionId + "/subdivisions",
                contentType: "application/json",
                type: "get",
                success: function (data) {
                    $.each(data, function (idx, item) {
                        html += "<option value='" + item.divisionName + "' exid='" + item.divisionId + "'>" + item.divisionName + "</option>";
                    });
                    $("#belongtoArea").append(html);
                }
            });
        });
    }
    // 判断打开那个表单--审核
    var openCheckForm = function (type) {
        var opencheckform;
        if (type == '0') {
            // 砖混结构
            opencheckform = sysPath + "/siftcollect/views/brickForm.html";
        } else if (type == '1') {
            // 多层钢筋混凝土结构
            opencheckform = sysPath + "/siftcollect/views/concreteForm.html";
        } else if (type == '2') {
            // 高层结构
            opencheckform = sysPath + "/siftcollect/views/highStructureForm.html";
        } else if (type == '3') {
            // 工业厂房结构
            opencheckform = sysPath + "/siftcollect/views/factoryForm.html";
        } else if (type == '4') {
            // 空旷结构
            opencheckform = sysPath + "/siftcollect/views/wideStructureForm.html";
        } else if (type == '5') {
            // 土木结构
            opencheckform = sysPath + "/siftcollect/views/buildingForm.html";
        } else if (type == '6') {
            // 木结构
            opencheckform = sysPath + "/siftcollect/views/woodForm.html";
        } else if (type == '7') {
            // 石结构
            opencheckform = sysPath + "/siftcollect/views/stoneForm.html";
        } else if (type == '8') {
            //其他
            opencheckform = sysPath + "/siftcollect/views/otherForm.html";
        } else if (type == '9') {
            //砖木结构
            opencheckform = sysPath + "/siftcollect/views/brickwoodForm.html";
        }
        return opencheckform;
    }
    var openReadonlyForm = function (type) {
        var openReadonlyForm;
        if (type == '0') {
            // 砖混结构
            openReadonlyForm = sysPath + "/siftcollect/views/brickFormReadonly.html";
        } else if (type == '1') {
            // 多层钢筋混凝土结构
            openReadonlyForm = sysPath + "/siftcollect/views/concreteFormReadonly.html";
        } else if (type == '2') {
            // 高层结构
            openReadonlyForm = sysPath + "/siftcollect/views/highStructureFormReadonly.html";
        } else if (type == '3') {
            // 工业厂房结构
            openReadonlyForm = sysPath + "/siftcollect/views/factoryFormReadonly.html";
        } else if (type == '4') {
            // 空旷结构
            openReadonlyForm = sysPath + "/siftcollect/views/wideStructureFormReadonly.html";
        } else if (type == '5') {
            // 土木结构
            openReadonlyForm = sysPath + "/siftcollect/views/buildingFormReadonly.html";
        } else if (type == '6') {
            // 木结构
            openReadonlyForm = sysPath + "/siftcollect/views/woodFormReadonly.html";
        } else if (type == '7') {
            // 石结构
            openReadonlyForm = sysPath + "/siftcollect/views/stoneFormReadonly.html";
        } else if (type == '8') {
            // 其他
            openReadonlyForm = sysPath + "/siftcollect/views/otherFormReadonly.html";
        } else if (type == '9') {
            // 砖木结构
            openReadonlyForm = sysPath + "/siftcollect/views/brickwoodFormReadonly.html";
        }

        return openReadonlyForm;
    }
    var createformValidator = function () {
        $("#taskSetForm").validate({
            rules: {
                taskNum: {
                    required: true,
                    maxlength: 100
                },
                taskName: {
                    required: true,
                    maxlength: 100
                }
            },
            messages: {
                taskNum: {
                    required: "任务编号不允许为空!",
                    maxlength: "任务编号长度不可以超过100"
                },
                taskName: {
                    required: "任务名称不允许为空!",
                    maxlength: "任务名称长度不可以超过100"
                }
            }
        });
    };
    var allotformValidator = function () {
        $("#allotTaskForm").validate({
            rules: {
                taskGroup: {
                    required: true,
                    maxlength: 100
                }
            },
            messages: {
                taskGroup: {
                    required: "任务小组不允许为空!",
                    maxlength: "任务小组长度不可以超过100"
                }
            }
        });
    };

    var initdivision = function () {
        var combotree = Combotree({
            // combo组件相关配置
            combo: {
                //要渲染的input的id
                id: "division",
                //下拉框的类型：单选or多选
                multi: false,
                key: {
                    idKey: "divisionId",
                    textKey: "divisionName"
                },
                //          placeholder: "请选择……",
                event: {
                    onShowPanel: function () {
                        console.log("show");
                    },
                    onHidePanel: function () {
                        console.log("hide");
                    },
                    onChange: function (n, o) {
                        $("#divisionId").val(n[0].divisionId);
                        $("#division").val(n[0].divisionName);
                    }
                }
            },
            // ztree组件相关配置
            ztree: {
                data: {
                    simpleData: {
                        enable: true,
                        idKey: "divisionId", // 主键属性名
                        pIdKey: "parentId" // 父节点属性名
                    },
                    key: {
                        name: "divisionName" // 显示名称属性名
                    }
                },
                check: {
                    chkboxType: {
                        'Y': '',
                        'N': ''
                    }
                }
            },
            data: {
                url: getDivisionController() + 'initDivisionZtree',
                type: 'GET',
                success: function () {

                }
            },
            formatter: function (node) {
                node.open = false;
            },
            value: $("#divisionId").val(),
            search: {
                enable: true,
                fields: ["divisionName"]
            }
        });
    }
    return {
        init: init
    };
});

var replayMap;